package rsj.proxy.bind;

import org.springframework.stereotype.Component;
import rsj.proxy.parse.ParamTypeEnum;
import rsj.proxy.parse.ParameterMapping;
import rsj.proxy.parse.SqlSource;

import java.lang.reflect.Method;
import java.util.List;

/**
 * 参数是简单数据类型-解析
 *
 * @author yuanqinglong
 * @since 2021/5/27 15:59
 */
@Component
public class SimpleParamResolveProcessor implements ParamResolveProcessor {


    @Override
    public ParamTypeEnum getSupportType() {
        return ParamTypeEnum.SIMPLE;
    }


    @Override
    public void doParamResolve(SqlSource sqlSource, ParameterMapping parameterMapping,
                                 Method method, Object[] args, List<Object> resolveParamList) {
        Object paramValue = this.handlingLikeQueries(parameterMapping, args[parameterMapping.getMethodParamIndex()]);
        resolveParamList.add(paramValue);
    }
}
